<%@include file="validarSession.jsp"%>
<%@include file="cabecera.jsp"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>COLSULTAR PODERES</title>
<script>
	function validar(){
		var a = document.f1.cbo1.value;
		var b = document.f1.cbo2.value;
		var c = document.f1.cbo3.value;
		var d = document.f1.TxtImporte.value;
		
		if (a=="") 
	{
		alert("Elija un RUC");
		return false;
	} 
	if (b=="")
	{
		alert("Elija un codigo de representante");
		return false;
	}
	if (c=="")
	{
		alert("Elija un codigo de poder");
		return false;
	}
	if (d=="")
	{
		alert("Ingrese el importe");
		return false;}
	
	return true;
	}
	</script>
</head>
<body>

	<form name="f1" method="post" action="VerificaPoder" onsubmit="return validar();">
<h2>VERIFICAR PODER</h2>
		<table width="300" height="104" border="1" cellpadding="0" cellspacing="0">

			<tr>
			<td> Ruc : </td>
			<td> <select style="width: 157px; " Name="cbo1">
			<%@page import="java.util.*, scream.modelo.Cliente,scream.modelo.Representante" %>
		<%
		Collection<Cliente> arreglocliente = (ArrayList<Cliente>)request.getAttribute("clientes");
		if(arreglocliente != null) { 
		int i = 1;
		for(Cliente x : arreglocliente) {
		%>  
        <option value=<%=x.getNuRuc()%>><% out.print(x.getNuRuc()); %></option>
		<% }  
  		} %>
			</select>
			</td></tr>
			<tr><td>
			Codigo Representante :</td> 
			
			
			<td>
			

<select style="width: 157px; " Name="cbo2">
			
			<%
		Collection<Representante> arreglorepresentante = (ArrayList<Representante>)request.getAttribute("representantes");
		if(arreglorepresentante != null) { 
		int i = 1;
		for(Representante x : arreglorepresentante) {
		%>  
        <option value=<%=x.getCoRepresentante()%>><% out.print(x.getCoRepresentante()); %></option>
		<% }  
  		} %>
			</select>
			</td></tr>
			<tr><td>
			Codigo Poder :</td> 
			<td>
			
			<select style="width: 157px; " Name="cbo3">
			<%@page import="java.util.*, scream.modelo.Poder" %>
			<%
		Collection<Poder> arreglopoder = (ArrayList<Poder>)request.getAttribute("poderes");
		if(arreglopoder != null) { 
		int i = 1;
		for(Poder x : arreglopoder) {
		%>  
        <option value=<%=x.getCoPoder()%>><% out.print(x.getCoPoder()); %></option>
		<% }  
  		} %>
			</select>
			
			</td></tr>
			<tr><td>
			Importe :</td>
			<td><label>
        <input type="text" name="txtImporte"  />
      </label></td>
			
</td></tr>
<tr>
      <td colspan="2">
        <input type="submit" value="Verificar" />
        <input type="button" value="Regresar" onclick="window.location='index.jsp' " />
      
      
      </td>
    </tr>
		</table>

<br>
<H1>
Resultado: <%
request.getAttribute("mirespuesta");
%>

${mirespuesta }
</H1>
	</form>
</body>
</html>